<template>
    <div class="newsinfo-container">
        <h1 class="title">{{newsInfo.title}}</h1>
        <p class="subtitle">
            <span>发表时间：{{newsInfo.add_time}} </span>
            <span>点击：{{newsInfo.click}}</span>
        </p>
        <hr> 
        <div class="content" v-html="newsInfo.content"></div>
        <comment :cid="this.id"></comment>
    </div>
</template>
<script>
import axios from 'axios'
import {Toast} from 'mint-ui'
import comment from '../subcomponents/Comment.vue'
export default {
    data(){
        return {
            newsInfo:{},
            id:this.$route.params.id
        }
    },
    created(){
        this.getNewsInfo()
    },
    methods:{
        getNewsInfo(){
            axios.get('http://www.lovegf.cn:8899/api/getnew/'+ this.id).then(res=>{
                if(res.data.status===0){
                    this.newsInfo = res.data.message[0]
                    Toast('请求成功')
                }
                else{
                    Toast('请求失败')
                }
            })
        }
    },
    components:{
        comment:comment
    }
}
</script>
<style>

</style>


